package org.sfx.rich

import javafx.collections.ListChangeListener

class RichListChangeListenerChange[E](underlying: ListChangeListener.Change[E]) {
  def addedSize = underlying.getAddedSize()
  def addedSubList = underlying.getAddedSubList()
  def from = underlying.getFrom()
  def list = underlying.getList()
  def permutation(index: Int) = underlying.getPermutation(index)
  def removed = underlying.getRemoved()
  def removedSize = underlying.getRemovedSize()
  def to = underlying.getTo()
  def removedTo = from + removedSize
  def addedTo = from + addedSize
  
  def foreach(f: => Unit) = {
    underlying.reset()
    while (underlying.next()) {
      f
    }
  }
}
